<html>
<body>
<style type="text/css">
div[class~="test"] {
  color: red;
  font-weight: bold;
}
</style>

<div class="test">
TEST1
</div><!--#test-->

<div class="xx test">
TEST2
</div><!--#test-->

<div class="test xx">
TEST3
</div><!--#test-->

<div class="xx test yy">
TEST4
</div><!--#test-->

<div class="xxtest">
TEST5
</div><!--#test-->

<div class="testxx">
TEST6
</div><!--#test-->

<div class="xxtestyy">
TEST7
</div><!--#test-->

<div class="xxtest yy">
TEST8
</div><!--#test-->

<div class="xx testyy">
TEST9
</div><!--#test-->
</body>
</html>